package com.example.stock.vo;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;

public class UnitVo {

    @TableId(type = IdType.AUTO)
    public Integer id;

    public Integer 群组;

    public String 名称;

    public String 代码;

    public Double 现价;

    public Double 成本;

    public Double 持仓;

    public Integer 阶梯;

    public Double 单位;

    public LocalDateTime 时间;

    public Double get市值(){
        return 持仓*现价;
    }

    public Double get盈亏(){
        return 持仓*(现价-成本);
    }

    public 涨 预涨;
    public 跌 预跌;

    public static class 涨{
        public Double 价格;
        public Double 数量;
        public Double 涨幅;
        public Double 预盈;
    }

    public static class 跌{
        public Double 价格;
        public Double 数量;
        public Double 跌幅;
        public Double 预亏;
    }

    @Override
    public String toString() {
        return "UnitEo2{" +
                "  现价=" + 现价 +
                ", 成本=" + 成本 +
                ", 持仓=" + 持仓 +
                ", 阶梯=" + 阶梯 +
                ", 市值=" + 现价*持仓 +
                ", 本金=" + 成本*持仓 +
                ", 盈亏=" + (现价-成本)*持仓 +
                "  }";
    }
}
